﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CMS.BLL;

public partial class Controls_StaticPages_ctrStaticPageDetail : System.Web.UI.UserControl
{
    int nCurentLanguage = Support.GetCurrentLanguage();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.GetPage();
        }
    }

    private void GetPage()
    {

        try
        {
            string sURL = Request.Url.ToString();
            lnkFacebook.NavigateUrl = "https://www.facebook.com/sharer/sharer.php?u=" + sURL;
            lnkTwitter.NavigateUrl = "http://twitter.com/intent/session?original_referer=" + sURL;

            int nPageID = ConvertData.ConvertToInt(Request.QueryString[Config.PAGE_ID]) ;
            StaticPages objStatic = new StaticPages();
            objStatic.LoadById(nPageID);

           
            //string sImage = objStatic.Data.Images;
            //if (sImage.Length >0)
            //{
            //    imgwhyus.Visible = true;
            //    imgwhyus.ImageUrl = Config.ROOT + Config.IMAGE_STATICPAGE_DEFAULT_UPLOAD + objStatic.Data.Images;
            //}
            //else

            //{ imgwhyus.Visible = false; }

            switch (nCurentLanguage)
            {
                case 1:
                    lblPageName.Text = ConvertData.ConvertToString(objStatic.Data.PageName1).ToUpper();
                    ltrContent.Text = ConvertData.ConvertToString(objStatic.Data.PageContent1);
                    break;
                case 2:
                    lblPageName.Text = ConvertData.ConvertToString(objStatic.Data.PageName2).ToUpper();
                    ltrContent.Text = ConvertData.ConvertToString(objStatic.Data.PageContent2);
                    break;
                case 3:
                    lblPageName.Text = ConvertData.ConvertToString(objStatic.Data.PageName3).ToUpper();
                    ltrContent.Text = ConvertData.ConvertToString(objStatic.Data.PageContent3);
                    break;
            }
        }
        catch
        {
            Response.Redirect("Default.aspx");
        }
    }
}